<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>修改邮箱客户端授权码</title>
    <style>
        body {
            font-family: 'Arial', sans-serif;
            margin: 0;
            padding: 20px;
            background-color: #f5f5f5;
        }
        .container {
            max-width: 600px;
            margin: 0 auto;
            background-color: #fff;
            padding: 20px;
            border-radius: 8px;
            box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
        }
        h1 {
            color: #333;
        }
        .form-group {
            margin-bottom: 15px;
        }
        label {
            display: block;
            margin-bottom: 5px;
            color: #666;
        }
        input {
            width: 100%;
            padding: 8px;
            border: 1px solid #ddd;
            border-radius: 4px;
            box-sizing: border-box;
        }
        button, a.button {
            padding: 10px 15px;
            border: none;
            border-radius: 4px;
            cursor: pointer;
            text-decoration: none;
            display: inline-block;
            margin-right: 10px;
        }
        .btn-save {
            background-color: #4CAF50;
            color: white;
        }
        .btn-back {
            background-color: #f1f1f1;
            color: #333;
        }
        .flash {
            padding: 10px;
            margin-bottom: 15px;
            border-radius: 4px;
        }
        .flash.success {
            background-color: #dff0d8;
            color: #3c763d;
        }
        .flash.error {
            background-color: #f2dede;
            color: #a94442;
        }
        .note {
            background-color: #f9f9f9;
            padding: 10px;
            border-left: 4px solid #ff9800;
            margin-top: 15px;
        }
    </style>
</head>
<body>
    <div class="container">
        <h1>修改邮箱客户端授权码</h1>

        {% with messages = get_flashed_messages(with_categories=true) %}
            {% if messages %}
                {% for category, message in messages %}
                    <div class="flash {{ category }}">{{ message }}</div>
                {% endfor %}
            {% endif %}
        {% endwith %}

        <form method="post">
            <div class="form-group">
                <label for="authorization_code">新的客户端授权码</label>
                <input type="text" id="authorization_code" name="authorization_code" required>
            </div>
            <button type="submit" class="btn-save">保存更改</button>
            <a href="{{ url_for('admin_dashboard') }}" class="button btn-back">返回</a>
        </form>

        <div class="note">
            <h3>注意事项：</h3>
            <p>1. 客户端授权码是用于第三方应用访问邮箱的专用密码，不是邮箱登录密码。</p>
            <p>2. 请确保您已在126邮箱网页版生成了新的客户端授权码。</p>
            <p>3. 生成授权码的步骤：登录126邮箱 -> 设置 -> 账户安全 -> 客户端授权密码 -> 开启并设置。</p>
            <p>4. 授权码更改后，系统将使用新的授权码发送邮件。</p>
        </div>
    </div>
</body>
</html>